home *** CD-ROM | disk | FTP | other *** search
/ Amiga Games: Greatest Hits 1996 / Amiga Games: Greatest Hits 1996.iso / spiele / publicdomain / amigamud-tt / magic / list-mortal.m < prev    next >
Text File  |  1996-07-05  |  9KB  |  338 lines

  1. /*
  2.  * magic/list-mortal.m Magic spells for mortals
  3.  */
  4.  
  5. use tp_util2
  6.  
  7. /***** Healing Spells *****
  8. * MinorHeal  1- 6
  9. * MajorHeal  4-20
  10. * TrueHeal   100
  11. **************************/
  12.  
  13. define tp_magic proc se_Heal(thing spell; string name)bool:
  14.   thing who;
  15.   int max,now,heal;
  16.  
  17.   who := FindAgent(name);
  18.   if who = nil then
  19.     Print("There is no one here called '" + name + "'.\n");
  20.   else
  21.     max := who@p_pHitMax;
  22.     now := who@p_pHitNow;
  23.     if max = 0 then
  24.       Print(name + " has no maximum hitpoints.\n");
  25.     elif now = max then
  26.       Print(name + " needs no healing.\n");
  27.     else
  28.       heal := parseDiceString(spell@p_sDice);
  29.       if heal + now > max then
  30.     heal := max - now;
  31.       fi;
  32.       who@p_pHitNow := now+heal;
  33.       Print(name + " healed " + IntToString(heal)+ " hit points.\n");
  34.       SPrint(who, FormatName(Me()@p_pName) + " has healed " + IntToString(heal)+ " hit points!\n");
  35.     fi;
  36.   fi;
  37.   true
  38. corp;
  39.  
  40. define tp_magic smm_Heal CreateThing(sm_DefaultSpell).
  41. smm_Heal@p_sEffect:=se_Heal.
  42. smm_Heal@p_sNull:="me".
  43.  
  44. define tp_magic sm_MinorHeal CreateThing(smm_Heal).
  45. sm_MinorHeal@p_sDesc:="minor heal at <who> - heal <who> 1-6 hitpoints.".
  46. sm_MinorHeal@p_sDice:="6+1".
  47. sm_MinorHeal@p_sName:="heal;minor".
  48. sm_MinorHeal@p_sCost:=2.
  49. sm_MinorHeal@p_sLevel:=1.
  50. sm_MinorHeal@p_sPotionDesc:="This potion is dark yellow.".
  51.  
  52. define tp_magic sm_MajorHeal CreateThing(smm_Heal).
  53. sm_MajorHeal@p_sDesc:="major heal at <who> - heal <who> 4-20 hitpoints.".
  54. sm_MajorHeal@p_sDice:="5555+4".
  55. sm_MajorHeal@p_sName:="heal;major".
  56. sm_MajorHeal@p_sCost:=5.
  57. sm_MajorHeal@p_sLevel:=2.
  58. sm_MajorHeal@p_sPotionDesc:="This potion is yellow.".
  59.  
  60. define tp_magic sm_TrueHeal CreateThing(smm_Heal).
  61. sm_TrueHeal@p_sDesc:="true heal at <who> - heal <who> 100 hitpoints.".
  62. sm_TrueHeal@p_sDice:="+100".
  63. sm_TrueHeal@p_sName:="heal;true".
  64. sm_TrueHeal@p_sCost:=10.
  65. sm_TrueHeal@p_sLevel:=3.
  66. sm_TrueHeal@p_sPotionDesc:="This potion is light yellow.".
  67.  
  68. /***** Timer Spells *****
  69. * SetTimer <seconds>
  70. **************************/
  71.  
  72. define tp_magic proc TimerRing(thing spellCopy)void:
  73.   thing who;
  74.  
  75.   who := spellCopy@p_sTarget;
  76.   ClearThing(spellCopy);
  77.   DelElement(who@p_pHiddenList, spellCopy);
  78.   SPrint(who, "** BEEP BEEP BEEP **\n");
  79. corp;
  80.  
  81. define tp_magic proc se_SetTimer(thing spell; string ta)bool:
  82.   thing me,spare;
  83.   int ti;
  84.  
  85.   ti := StringToInt(ta);
  86.   me := Me();
  87.   spare:=CreateThing(Parent(spell));
  88.   spare@p_sTarget := me;
  89.   DoAfter(ti, spare, TimerRing);
  90.   AddTail(me@p_pHiddenList,spare);
  91.   Print("You hear something ticking in your head.\n");
  92.   true
  93. corp;
  94.  
  95. define tp_magic sm_SetTimer CreateThing(sm_DefaultSpell).
  96. sm_SetTimer@p_sDesc:="Set Timer on <seconds>.".
  97. sm_SetTimer@p_sName:="timer;set".
  98. sm_SetTimer@p_sCost:=1.
  99. sm_SetTimer@p_sLevel:=1.
  100. sm_SetTimer@p_sEffect:=se_SetTimer.
  101.  
  102. /***** Might Spells *****
  103. * Might1 <who>
  104. * Might2 <who>
  105. **************************/
  106.  
  107. define tp_magic proc MightCancel(thing th)void:
  108.   thing who;
  109.  
  110.   who := th@p_sTarget;
  111.   who@p_pStrength := who@p_pStrength - th@p_sPower;
  112.   ClearThing(th);
  113.   DelElement(who@p_pHiddenList, th);
  114.   SPrint(who, "You suddenly feel let down.\n");
  115. corp;
  116.  
  117. define tp_magic proc se_Might(thing spell; string name)bool:
  118.   thing who,spare;
  119.  
  120.   who := FindAgent(name);
  121.   if who = nil then
  122.     Print("There is no one here called '" + name + "'.\n");
  123.   else
  124.     spare:=CreateThing(Parent(spell));
  125.     spare@p_sTarget := who;
  126.     who@p_pStrength := who@p_pStrength + spare@p_sPower;
  127.     SPrint(who,"You feel full of strength.\n");
  128.     DoAfter(spare@p_sDuration, spare, MightCancel);
  129.     AddTail(who@p_pHiddenList,spare);
  130.   fi;
  131.   true
  132. corp;
  133.  
  134. define tp_magic sm_Might CreateThing(sm_DefaultSpell).
  135. sm_Might@p_sEffect:=se_Might.
  136. sm_Might@p_sNull:="me".
  137. sm_Might@p_sDesc:="Might at <who>, enhances <who>'s strength for a short time.".
  138. sm_Might@p_sName:="might;lesser".
  139. sm_Might@p_sCost:=1.
  140. sm_Might@p_sLevel:=1.
  141. sm_Might@p_sPower:=1.
  142. sm_Might@p_sDuration:=60.
  143. sm_Might@p_sPotionDesc:="This potion is dark red.".
  144. define tp_magic sm_Might2 CreateThing(sm_Might).
  145. sm_Might2@p_sName:="might2;lesser".
  146. sm_Might2@p_sCost:=2.
  147. sm_Might2@p_sLevel:=2.
  148. sm_Might2@p_sDuration:=120.
  149. sm_Might2@p_sPotionDesc:="This potion is red.".
  150. define tp_magic sm_Might3 CreateThing(sm_Might2). /* inherit from Might2 */
  151. sm_Might3@p_sName:="might;greater".
  152. sm_Might3@p_sPower:=2.
  153. sm_Might3@p_sCost:=5.
  154. sm_Might3@p_sLevel:=3.
  155. sm_Might3@p_sPotionDesc:="This potion is light red.".
  156.  
  157.  
  158. /***** Speed Spells *****
  159. * Speed  <who>
  160. * Speed2 <who>
  161. **************************/
  162.  
  163. define tp_magic proc SpeedCancel(thing th)void:
  164.   thing who;
  165.  
  166.   who := th@p_sTarget;
  167.   who@p_pSpeed := who@p_pSpeed - th@p_sPower;
  168.   ClearThing(th);
  169.   DelElement(who@p_pHiddenList, th);
  170.   SPrint(who, "The world seems to speed up slightly.\n");
  171. corp;
  172.  
  173. define tp_magic proc se_Speed(thing spell; string name)bool:
  174.   thing who,spare;
  175.  
  176.   who := FindAgent(name);
  177.   if who = nil then
  178.     Print("There is no one here called '" + name + "'.\n");
  179.   else
  180.     spare:=CreateThing(Parent(spell));
  181.     spare@p_sTarget := who;
  182.     who@p_pSpeed := who@p_pSpeed + spare@p_sPower;
  183.     SPrint(who,"You notice the world slow down slightly.\n");
  184.     DoAfter(spare@p_sDuration, spare, SpeedCancel);
  185.     AddTail(who@p_pHiddenList,spare);
  186.   fi;
  187.   true
  188. corp;
  189.  
  190. define tp_magic sm_Speed CreateThing(sm_DefaultSpell).
  191. sm_Speed@p_sNull:="me".
  192. sm_Speed@p_sEffect:=se_Speed.
  193. sm_Speed@p_sDesc:="speed at <who>, enhances <who>'s speed for a short time.".
  194. sm_Speed@p_sName:="speed;lesser".
  195. sm_Speed@p_sCost:=2.
  196. sm_Speed@p_sLevel:=1.
  197. sm_Speed@p_sPower:=1.
  198. sm_Speed@p_sDuration:=60.
  199. sm_Speed@p_sPotionDesc:="This potion is dark green.".
  200. define tp_magic sm_Speed2 CreateThing(sm_Speed).
  201. sm_Speed2@p_sName:="speed2;lesser".
  202. sm_Speed2@p_sCost:=4.
  203. sm_Speed2@p_sLevel:=2.
  204. sm_Speed2@p_sDuration:=120.
  205. sm_Speed2@p_sPotionDesc:="This potion is green.".
  206. define tp_magic sm_Speed3 CreateThing(sm_Speed2). /* inherit from Speed2 */
  207. sm_Speed3@p_sName:="speed;greater".
  208. sm_Speed3@p_sPower:=2.
  209. sm_Speed3@p_sCost:=5.
  210. sm_Speed3@p_sLevel:=4.
  211. sm_Speed3@p_sPotionDesc:="This potion is light green.".
  212.  
  213. /***** Endurance Spells *****
  214. * Endurance <who>
  215. * Endurance2 <who>
  216. **************************/
  217.  
  218. define tp_magic proc EnduranceCancel(thing th)void:
  219.   thing who;
  220.   int m;
  221.  
  222.   who := th@p_sTarget;
  223.   m:=who@p_pHitMax - th@p_sPower;
  224.   who@p_pHitMax:=m;
  225.   if who@p_pHitNow>m then
  226.     who@p_pHitNow:=m;
  227.   fi;
  228.   ClearThing(th);
  229.   DelElement(who@p_pHiddenList, th);
  230.   SPrint(who, "The healthy glow vanishes.\n");
  231. corp;
  232.  
  233. define tp_magic proc se_Endurance(thing spell; string name)bool:
  234.   thing who,spare;
  235.  
  236.   who := FindAgent(name);
  237.   if who = nil then
  238.     Print("There is no one here called '" + name + "'.\n");
  239.   else
  240.     spare:=CreateThing(Parent(spell));
  241.     spare@p_sTarget := who;
  242.     who@p_pHitMax := who@p_pHitMax + spare@p_sPower;
  243.     who@p_pHitNow := who@p_pHitNow + spare@p_sPower;
  244.     SPrint(who,"You feel much more healthy.\n");
  245.     DoAfter(spare@p_sDuration, spare, EnduranceCancel);
  246.     AddTail(who@p_pHiddenList,spare);
  247.   fi;
  248.   true
  249. corp;
  250.  
  251. define tp_magic sm_Endurance CreateThing(sm_DefaultSpell).
  252. sm_Endurance@p_sNull:="me".
  253. sm_Endurance@p_sEffect:=se_Endurance.
  254. sm_Endurance@p_sDesc:="Endurance at <who>, enhances <who>'s endurance for a short time.".
  255. sm_Endurance@p_sName:="endurance;lesser".
  256. sm_Endurance@p_sCost:=2.
  257. sm_Endurance@p_sLevel:=1.
  258. sm_Endurance@p_sPower:=10.
  259. sm_Endurance@p_sDuration:=60.
  260. sm_Endurance@p_sPotionDesc:="This potion is dark blue.".
  261. define tp_magic sm_Endurance2 CreateThing(sm_Endurance).
  262. sm_Endurance2@p_sName:="endurance2;lesser".
  263. sm_Endurance2@p_sCost:=4.
  264. sm_Endurance2@p_sLevel:=2.
  265. sm_Endurance2@p_sDuration:=120.
  266. sm_Endurance2@p_sPotionDesc:="This potion is blue.".
  267. define tp_magic sm_Endurance3 CreateThing(sm_Endurance2). /* inherit from Endurance2 */
  268. sm_Endurance3@p_sName:="endurance;greater".
  269. sm_Endurance3@p_sPower:=20.
  270. sm_Endurance3@p_sCost:=5.
  271. sm_Endurance3@p_sLevel:=4.
  272. sm_Endurance3@p_sPotionDesc:="This potion is light blue.".
  273.  
  274.  
  275.  
  276. /***** Light Spells *****
  277. * Light  <what>
  278. * Light2 <what>
  279. **************************/
  280.  
  281. define tp_magic proc LightCancel(thing th)void:
  282.   thing who;
  283.  
  284.   PassiveUnLightObject(th@p_sTarget);
  285.  
  286.   who := th@p_sCaster;
  287.   ClearThing(th);
  288.   DelElement(who@p_pHiddenList, th);
  289. corp;
  290.  
  291. define tp_magic proc se_Light(thing spell; string name)bool:
  292.   thing who,spare, me;
  293.   status st;
  294.  
  295.   me:=Me();
  296.   st:=FindName(me@p_pCarrying,p_oName,name);
  297.   if st=fail then
  298.     st:=FindName(Here()@p_rContents,p_oName,name);
  299.   fi;
  300.   if st=succeed then
  301.     who:=FindResult();
  302.     SetIt(who);
  303.     st:=ActiveLightObject();
  304.     if st=succeed then
  305.       spare:=CreateThing(Parent(spell));
  306.       spare@p_sTarget := who;
  307.       spare@p_sCaster := me;
  308.       DoAfter(spare@p_sDuration, spare, LightCancel);
  309.       AddTail(me@p_pHiddenList,spare);
  310.     fi;
  311.     true
  312.   elif st=continue then
  313.     Print(name + " is ambiguous.\n");
  314.     false
  315.   else
  316.     Print(AAn("There ","no " + name) + " here.\n");
  317.     false
  318.   fi
  319. corp;
  320.  
  321. define tp_magic sm_Light CreateThing(sm_DefaultSpell).
  322. sm_Light@p_sEffect:=se_Light.
  323. sm_Light@p_sDesc:="Light on <what>, causes <what> to emit light for a short time.".
  324. sm_Light@p_sName:="object;lesser,light".
  325. sm_Light@p_sCost:=2.
  326. sm_Light@p_sLevel:=1.
  327. sm_Light@p_sDuration:=60.
  328. define tp_magic sm_Light2 CreateThing(sm_Light).
  329. sm_Light2@p_sName:="object2;lesser,light".
  330. sm_Light2@p_sCost:=6.
  331. sm_Light2@p_sLevel:=3.
  332. sm_Light2@p_sDuration:=120.
  333.  
  334.  
  335. /**** End of file */
  336. unuse tp_util2
  337.  
  338.